<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        a::after,
        label::after {
            color: transparent;
            text-shadow: 0 0 0 #fff;
        }

        @keyframes move {
            0% {
                transform: translateX(-50%);
            }

            100% {
                transform: translateX(-50%) rotate(360deg);
            }
        }

        .clock {
            width: 300px;
            height: 300px;
            border-radius: 50%;
            margin: 100px auto;
            position: relative;
            background: url(./clock.jpg) no-repeat -15px -15px;
            background-size: 330px;
        }

        .center {
            position: absolute;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: #000;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }

        .hour,
        .minute,
        .second {
            position: absolute;
            left: 50%;
            transform-origin: center bottom;
            animation: move linear infinite;
            animation-play-state: paused;
        }

        .hour {
            width: 8px;
            height: 50px;
            background: #000;
            border-radius: 4px 4px 0 0;
            top: 100px;
            animation-duration: 86400s;
        }

        .minute {
            width: 4px;
            height: 80px;
            background: #000;
            border-radius: 2px 2px 0 0;
            top: 70px;
            animation-duration: 3600s;
        }

        .second {
            width: 2px;
            height: 120px;
            background: red;
            border-radius: 1px 1px 0 0;
            top: 30px;
            animation-duration: 60s;
            animation-timing-function: steps(60);
        }

        label,
        a {
            display: block;
            line-height: 50px;
            color: #fff;
            font-size: 40px;
            text-align: center;
            border-radius: 10px;
            position: absolute;
            top: -100px;
            padding: 10px;
            white-space: nowrap;
            cursor: pointer;
        }

        label[for="pause"] {
            background: red;
            left: 10%;
        }

        a {
            background: #000;
            right: 10%;
            text-decoration: none;
        }

        label[for="pause"]::after {
            content: "开始";
        }

        a::after {
            content: "重置";
        }

        input:checked~.hour,
        input:checked~.minute,
        input:checked~.second {
            animation-play-state: running;
        }

        input:checked+label::after {
            content: "暂停";
        }

        .clock-text {
            position: absolute;
            bottom: -100px;
            width: 100%;
            height: 50px;
            background: #afb;
            display: flex;
            justify-content: space-around;
            align-items: center;
            font-size: 40px;
        }
    </style>
</head>

<body>
    <div class="clock">
        <input type="checkbox" id="pause" hidden>
        <label for="pause"></label>
        <a href=""></a>
        <div class="center"></div>
        <div class="hour"></div>
        <div class="minute"></div>
        <div class="second"></div>
        <div class="clock-text">
            <div id="hour">00</div>
            <div>:</div>
            <div id="minute">00</div>
            <div>:</div>
            <div id="second">00</div>
        </div>
    </div>
</body>
<script>
    document.getElementById('pause').onclick = function () {
        setInterval(function () {
            getTime()
        }, 1000)
        var s = 0;
        var m = 0;
        var h = 0;

        function getTime() {
            s++;
            if (s == 60) {
                s = 0;
                m++;
            }
            if (m == 60) {
                m = 0;
                h++;
            }
            document.querySelector('#second').innerHTML = s < 10 ? '0' + s : s;
            document.querySelector('#minute').innerHTML = m < 10 ? '0' + m : m;
            document.querySelector('#hour').innerHTML = h < 10 ? '0' + h : h;
        }
    }
</script>

</html>